import 'package:dio/dio.dart';

import '../code.dart';
import '../result_data.dart';

///是否需要弹提示
const NOT_TIP_KEY = "noTip";

/// 错误拦截
class ErrorInterceptors extends InterceptorsWrapper {
  @override
  onRequest(RequestOptions options, handler) async {
    //没有网络
    // var connectivityResult = await (Connectivity().checkConnectivity());
    // if (connectivityResult == ConnectivityResult.none) {
    //   return handler.reject(DioException(
    //       requestOptions: options,
    //       type: DioExceptionType.connectionError,
    //       response: Response(
    //           requestOptions: options,
    //           data: ResultData(
    //               Code.errorHandleFunction(Code.networkError, "", false),
    //               false,
    //               Code.networkError))));
    // }
    return super.onRequest(options, handler);
  }
}
